package com.xiangmo.travel.Controller;

import com.xiangmo.travel.Dto.ResultData;
import com.xiangmo.travel.Dvo.AttractionCollectCountDvo;
import com.xiangmo.travel.Dvo.TeamTapCountDvo;
import com.xiangmo.travel.Enums.CodeAndMsg;
import com.xiangmo.travel.Service.CollectService;
import com.xiangmo.travel.Service.TeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/tap")
public class TapController {
    @Autowired
    private TeamService teamService;
    @Autowired
    private CollectService collectService;
    //返回用户组队次数排名 前10
    @GetMapping("/team")
    public ResultData<List<TeamTapCountDvo>> queryTeamRequest(){
        List<TeamTapCountDvo> topUser = teamService.getTopTenRanking();
        return new ResultData<>(CodeAndMsg.SUCCESS.getCode(),
                CodeAndMsg.SUCCESS.getMessage(), topUser, null);
    }

    //返回景点被收藏的次数 前10
    @GetMapping("/attraction")
    public ResultData<List<AttractionCollectCountDvo>> queryAttractionRequest(){
        List<AttractionCollectCountDvo> topAttraction = collectService.getTop10SpotByCollectCount();
        return new ResultData<>(CodeAndMsg.SUCCESS.getCode(),
                CodeAndMsg.SUCCESS.getMessage(), topAttraction, null);
    }
}
